package com.gitee.wsl.ext.bitcode

/** Takes n[bits] of [this] [Int], and extends the last bit, creating a plain [Int] in one's complement */
public fun Int.signExtend(bits: Int): Int = (this shl (32 - bits)) shr (32 - bits) // Int.SIZE_BITS
/** Takes n[bits] of [this] [Long], and extends the last bit, creating a plain [Long] in one's complement */
public fun Long.signExtend(bits: Int): Long = (this shl (64 - bits)) shr (64 - bits) // Long.SIZE_BITS
